<?php

/**
 * Power By Tmac PHP MVC framework
 * $Author: zwt007 $  <zwttmac@qq.com>
 * $Id: TmacPHP.php 31 2011-07-11 15:25:51Z zwt007 $
 * http://www.t-mac.org； 
 */
//加载配置文件
require(TMAC_BASE_PATH . 'Tmac.config.php');

ini_set('include_path',
        ini_get('include_path') . PATH_SEPARATOR
        . TMAC_PATH . PATH_SEPARATOR
        . TMAC_PATH . 'Database' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . TMAC_PATH . 'Cache' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . TMAC_PATH . 'Plugin' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . APPLICATION_ROOT . 'Model' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . APPLICATION_ROOT . 'Plugin' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
        . APPLICATION_ROOT . 'Controller' . DIRECTORY_SEPARATOR . PATH_SEPARATOR
);

/**
 * 自动加载类
 *
 * @param string $class
 */
function __autoload($class)
{
    require_once($class . '.class.php');
}

//Tmac虚拟根目录
define('ROOT', str_replace('index.php', '', $_SERVER['SCRIPT_NAME']));
//Tmac URL 根目录
define('URL', ROOT . ($TmacConfig['Common']['urlrewrite'] ? '' : 'index.php'));
//Tmac URL 根目录
define('PHP_SELF', substr(htmlspecialchars($_SERVER['PHP_SELF']), 1));